package Netease;

import java.util.Scanner;

/**
 * @author Jimmy Zhan WORKSTATION
 * @since 2023/8/20 15:11
 * 说明：一个数组的元素分成两个子数组，其中两个子数组各自的元素和都要大于k
 */

public class NeteaseNums {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();

        int right = input.indexOf("]");
        String arrayPart = input.substring(1, right);
        String kPart = input.substring(right + 2, input.length());

        String[] values = arrayPart.split(",");
        int[] nums = new int[values.length];
        for (int i = 0; i < values.length; i++) {
            nums[i] = Integer.parseInt(values[i]);
        }
        int k = Integer.parseInt(kPart);

        int res = countWays(nums, k);
        System.out.println(res);
    }

    private static int countWays(int[] nums, int k) {
        int n = nums.length;
        int totalWays = 0;

        for (int i = 0; i < (1 << n); i++) {
            int sum1 = 0, sum2 = 0;
            for (int j = 0; j < n; j++) {
                if ((i & (1 << j)) > 0) {
                    sum1 += nums[j];
                } else {
                    sum2 += nums[j];
                }
            }

            if (sum1 >= k && sum2 >= k) {
                totalWays++;
            }
        }
        return totalWays;
    }
}
